namespace Test
{
    class GameObject
    {
        private List<Component> _comps = new List<Component>();

        public void AddComponent(Component comp)
        {
            _comps.Add(comp);
        }
        public void RemoveComponent(Component comp)
        {
            _comps.Remove(comp);
        }
        public Component GetComponent(string compName)
        {
            return null;
        }

        public void Start()
        {
            foreach(var comp in _comps)
            {
                comp.Start();  // 多态
            }
        }

        public void Update()
        {
            foreach(var comp in _comps)
            {
                comp.Update();  // 多态
            }
        }

        public GameObject()
        {
            Console.WriteLine("GameObject: Construction");
        }
    }
}